package com.example.server.web.controller;

import com.example.server.web.domain.RespBean;
import com.example.server.web.domain.page.PageQueryDto;
import com.example.server.web.domain.dto.QuestionnaireSummaryDto;
import com.example.server.web.domain.dto.QuestionnaireSummaryMutilDto;
import com.example.server.web.service.FactTableService;
import com.example.server.web.service.QuestionnaireSummaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController("/report")
@Api(tags = "报表接口")
public class ReportController {

    @Autowired
    private FactTableService factTableService;

    @Autowired
    private QuestionnaireSummaryService summaryService;

    @ApiOperation("查询报表分页数据")
    @GetMapping("/getPage")
    private RespBean getPage(PageQueryDto pageQueryDto, QuestionnaireSummaryDto summaryDto){
        Map<String, Object> map = summaryService.getPage(pageQueryDto, summaryDto);
        return RespBean.success("查询成功",map);
    }

    @ApiOperation("查询报表数据（多维度）")
    @PostMapping("/getPageByMulti")
    private RespBean getPageByMulti(@RequestBody QuestionnaireSummaryMutilDto summaryDto){
        Map<String, Object> map = summaryService.getPageMulti(summaryDto);
        return RespBean.success("查询成功",map);
    }
}
